<!--
*Author：富行天下团队
 *
 *代码由框架生成,任何更改都可能导致被代码生成器覆盖
 *业务请在@/extension/mall/Mall_attributes.js此处编写
 -->
<template>
  <div>
    <view-grid ref="grid" :columns="columns" :detail="detail" :editFormFields="editFormFields" :editFormFileds="editFormFields" :editFormOptions="editFormOptions"
      :searchFormFields="searchFormFields" :searchFormFileds="searchFormFields" :searchFormOptions="searchFormOptions" :table="table" :extend="extend">
    </view-grid>
  </div>
</template>

<script>
import extend from '@/extension/mall/Campsite.js'
import ViewGrid from '@/components/basic/ViewGrid.vue'
var vueParam = {
  components: {
    ViewGrid,
  },
  data() {
    return {
      table: {
        key: 'campsite_id_fk',
        footer: 'Foots',
        cnName: '冬/夏令营',
        name: 'Campsite',
        url: '/Campsite/',
        sortName: 'createDate',
      },
      extend: extend,
      editFormFields: {
        is_pre: '',
        campsite_desc: '',
        merchantCode: '',
        merchantName: '',
        signcode: '',
        campsite_state: '3',
        campsite_statu: '',
        cover: [],
        organization: '',
        campsite_detail: '',
        campsite_type: '',
        is_econtract: '',
        econtractcode: '',
        position: '',
        campsite_id_fk: '',
        contact: '',
        is_insure: '',
        slideshow: '',
        campsite_name: '',
        contactphone: '',
        phasedayjson: '22222',
        is_subaccount: '',
        is_sign: '',
        vendor_code: '',
        vendor_name: '',
        video: '',
        startAddress: '',
        endAddress: '',
        is_open: '',
        distributorNews_id: '',
      },
      editFormOptions: [
        [
          {
            title: '营地头图',
            maxSize: 1,
            required: false,
            field: 'cover',
            type: 'imgupgrade',
            maxFile: 1, //图片个数
            multiple: true, //最多可选文件数量，必须multiple=true，才会生效
            colSize: '4',
          },
          {
            title: '营地名称',
            required: true,
            field: 'campsite_name',
            type: 'text',
            colSize: '4',
          },
          {
            title: '供应商',
            required: true,
            dataKey: 'mall_supplier',
            data: [],
            field: 'vendor_name',
            type: 'select',
            colSize: '4',
          },
          // {
          //   'title': '',
          //   'required': true,
          //   'field': 'campsite_id_fk',

          //   'type': '',
          //    'colSize': ''
          // },
        ],
        [
          {
            dataKey: 'is_sign',
            data: [],
            title: '填写报名单',
            field: 'is_sign',
            type: 'switch',
            colSize: '4',
            required: true,
          },
          {
            title: '报名单',
            required: true,
            dataKey: 'mall_form',
            data: [],
            field: 'signcode',
            type: 'select',
            colSize: '4',
            hidden: false,
          },
          {
            dataKey: 'campsiteType',
            data: [],
            title: '营地类型',
            required: true,
            field: 'campsite_type',
            type: 'select',
            colSize: '4',
          },
        ],
        // [
        //  {
        //   'dataKey': 'campsite_desc',
        //   'data': [],
        //   'title': '营地图文',
        //   'required': true,
        //   'field': 'campsite_desc',
        //   'type': 'select',
        //   'colSize': '4'
        // },
        // ],
        [
          {
            title: '组织机构',
            required: true,
            field: 'organization',
            type: 'text',
            colSize: '4',
          },
          {
            title: '联系人',
            required: true,
            field: 'contact',
            type: 'text',
            colSize: '4',
          },
          {
            title: '联系方式',
            required: true,
            field: 'contactphone',  
            type: 'phone',
            colSize: '4',
          },
          {
            title: '简版行程',
            hidden: true,
            field: 'phasedayjson',
            type: 'text',
            colSize: '4',
          },
        ],
        [
          {
            dataKey: 'is_subaccount',
            data: [],
            title: '是否分账',
            field: 'is_subaccount',
            type: 'switch',
            colSize: '2',
            hidden: true,
          },
          {
            dataKey: 'is_insure',
            data: [],
            title: '是否保险',
            field: 'is_insure',
            type: 'switch',
            colSize: '2',
            hidden: true,
          },
          {
            title: '是否预置',
            field: 'is_pre',
            type: 'switch',
            colSize: '2',
            hidden: true,
          },
          {
            dataKey: 'is_econtract',
            data: [],
            title: '启用电子合同',
            field: 'is_econtract',
            type: 'switch',
            colSize: '4',
          },
          {
            title: '合同',
            required: true,
            dataKey: 'contract_name',
            data: [],
            field: 'econtractcode',
            type: 'select',
            colSize: '4',
            hidden: false,
          },
          {
            dataKey: '',
            title: '地址',
            required: true,
            field: 'position',
            remote: true,
            data: [],
            placeholder: '输入地址关键字段搜索',
            type: 'select',
            colSize: '4',
          },
        ],
        [
          {
            dataKey: 'campsite_status',
            data: [],
            title: '营地状态',
            required: false,
            hidden: true,
            field: 'campsite_state', //对应数组库
            type: 'select',
            colSize: '4',
          },

          {
            title: '简介描述',
            required: true,
            field: 'campsite_detail',
            type: 'text',
            colSize: '4',
          },
          {
            dataKey: '',
            title: '启程地址',
            // required: true,
            field: 'startAddress',
            remote: true,
            data: [],
            placeholder: '输入地址关键字段搜索',
            type: 'select',
            colSize: '4',
          },
          {
            dataKey: '',
            title: '返程地址',
            // required: true,
            field: 'endAddress',
            remote: true,
            data: [],
            placeholder: '输入地址关键字段搜索',
            type: 'select',
            colSize: '4',
          },
        ],
        [
          {
            title: '启程时间',
            field: 'startAddressTime',
            type: 'datetime',
            colSize: '4',
          },
          {
            title: '返程时间',
            field: 'endAddressTime',
            type: 'datetime',
            colSize: '4',
          },
          {
            title: '是否公开',
            field: 'is_open',
            colSize: '4',
            type: 'switch',
          },
        ],
        [
          {
            title: '直营分销商',
            dataKey: '',
            data: [],
            field: 'distributorNews_id',
            colSize: '4',
            type: 'selectList',
            hidden: true,
          },
        ],
      ],
      searchFormFields: { campsite_name: '', campsite_type: '' },
      searchFormOptions: [
        [
          { title: '营地名称', field: 'campsite_name', type: 'like' },
          {
            dataKey: 'campsiteType',
            data: [],
            title: '营地类型',
            field: 'campsite_type',
            type: 'select',
          },
        ],
      ],
      columns: [
        {
          field: 'campsite_id_fk',
          title: '营地编号',
          type: 'int',
          width: 90,
          hidden: true,
          readonly: true,
          require: true,
          align: 'left',
        },
        {
          field: 'campsite_name',
          title: '营地名称',
          type: 'string',
          width: 150,
          require: true,
          align: 'left',
        },
        {
          field: 'campsite_state',
          title: '营地状态',
          type: 'select',
          width: 90,
          align: 'left',
          bind: { key: 'campsite_status', data: [] },
          width: 90,
          align: 'left',
        },
        {
          field: 'campsite_type',
          title: '营地类型',
          type: 'select',
          bind: { key: 'campsiteType', data: [] },
          width: 120,
          require: true,
          align: 'left',
        },
        {
          field: 'labelId',
          title: '营地标签',
          type: 'string',
          width: 100,
          align: 'left',
        },
        {
          field: 'contact',
          title: '联系人',
          type: 'string',
          width: 90,
          require: true,
          align: 'left',
        },
        {
          field: 'contactphone',
          title: '联系电话',
          type: 'string',
          width: 120,
          require: true,
          align: 'left',
        },
        // { field: 'phasedayjson', title: '简版行程', type: 'string', width: 120, hidden: true, align: 'left' },
        {
          field: 'cover',
          title: '封面图',
          type: 'imgupgrade',
          width: 180,
          require: false,
          align: 'left',
        },
        {
          field: 'createDate',
          title: '创建时间',
          type: 'datetime',
          width: 90,
          align: 'left',
          sortable: true,
        },
        {
          field: 'createID',
          title: '创建人ID',
          type: 'int',
          width: 90,
          hidden: true,
          align: 'left',
        },
        {
          field: 'creator',
          title: '创建人',
          type: 'string',
          width: 180,
          align: 'left',
        },
        {
          field: 'is_econtract',
          title: '是否启用电子合同',
          type: 'int',
          bind: { key: 'enable', data: [] },
          width: 90,
          align: 'left',
        },
        {
          field: 'is_insure',
          title: '是否保险',
          type: 'int',
          bind: { key: 'enable', data: [] },
          width: 90,
          align: 'left',
        },
        {
          field: 'is_subaccount',
          title: '是否分账',
          type: 'int',
          bind: { key: 'enable', data: [] },
          width: 90,
          align: 'left',
        },
        {
          field: 'modifier',
          title: '修改人',
          type: 'string',
          width: 180,
          align: 'left',
        },
        {
          field: 'modifyDate',
          title: '修改时间',
          type: 'datetime',
          width: 90,
          align: 'left',
          sortable: true,
        },
        {
          field: 'modifyID',
          title: '修改人ID',
          type: 'int',
          width: 90,
          hidden: true,
          align: 'left',
        },
        {
          field: 'organization',
          title: '组织机构',
          type: 'string',
          width: 120,
          require: true,
          align: 'left',
        },
        {
          field: 'position',
          title: '位置坐标',
          type: 'string',
          width: 90,
          align: 'left',
        },
        {
          field: 'slideshow',
          title: '轮播图',
          type: 'string',
          width: 220,
          require: true,
          align: 'left',
        },
        {
          field: 'vendor_code',
          title: '供应商编号',
          type: 'string',
          width: 220,
          require: true,
          align: 'left',
        },
        {
          field: 'vendor_name',
          title: '供应商名称',
          type: 'string',
          width: 220,
          require: true,
          align: 'left',
          bind: {
            key: 'mall_supplier',
            data: [],
          },
        },
        {
          field: 'campsite_detail',
          title: '简介描述',
          type: 'string',
          width: 180,
          require: true,
          align: 'left',
        },
        {
          field: 'video',
          title: '宣传视频',
          type: 'string',
          width: 220,
          require: true,
          align: 'left',
        },
      ],
      detail: {
        cnName: '营期',
        columns: [
          {
            field: 'phase_id_fk',
            title: '主键',
            type: 'int',
            width: 90,
            hidden: true,
            readonly: true,
            require: true,
            align: 'left',
          },
          {
            field: 'timeContainer',
            title: '营期',
            type: 'datetimerange',
            min: Date.now(),
            edit: { type: 'datetimerange' },
            width: 200,
            align: 'left',
            sortable: true,
          },
          {
            field: 'phase_name',
            title: '期次名称',
            range: true,
            type: 'text',
            edit: { type: 'text' },
            required: false,
            width: 90,
            align: 'left',
            sortable: true,
          },
          {
            field: 'status',
            title: '是否可用',
            type: 'switch',
            edit: { type: 'switch' },
            width: 60,
            align: 'left',
            sortable: true,
          },
          // { field: 'messagereview', title: '是否可用', type: 'string', width: 90, align: 'left', sortable: true,hidden: true, },
          {
            field: 'deadlinetime',
            title: '报名截止时间',
            type: 'date',
            edit: { type: 'date' },
            hidden: false,
            width: 90,
            align: 'left',
            sortable: true,
          },
          {
            field: 'people_num',
            title: '人数',
            type: 'text',
            edit: { type: 'text' },
            hidden: false,
            width: 40,
            align: 'left',
            sortable: true,
          },
          {
            field: 'stocknum',
            title: '库存',
            type: 'text',
            edit: { type: 'text' },
            width: 40,
            align: 'left',
            sortable: true,
          },
          {
            field: 'phasedayjson',
            title: '简版行程',
            type: 'string',
            width: 120,
            hidden: true,
            align: 'left',
          },
        ],
        sortName: 'createDate',
        key: 'phase_id_fk',
      },
    }
  },
}
export default vueParam
</script>
